class Solution {
public:
    long long minimumSteps(string s)
    {
        long long ans = 0;
        int left = 0;//用于计算左边0的下标
        int right = 0;
        while (right < s.size())
        {
            if (s[right] == '0' && s[left] != 0)
            {
                ans += right - left;
                left++;
            }
            else if (s[right] == '0' && s[left] == '0')
                left++;
            right++;
        }
        return ans;
    }
};